<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'experiencia.label', default: 'Experiencia')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="cabelistlateral"><img src="${resource(dir:'images',file:'seta_cabecalho_20x20.png')}" /> Cadastro de Experiências</div><br/>
        <inc:include url="/includes/inc_estagiario_menu.gsp" />
        <div class="body">
             <form method="post" action="${createLink(controller:'experiencia', action:'save')}">
                <div class="dialog dadospessoais">
                    <g:if test="${flash.message}">
                        <div class="message">${flash.message}</div>
                    </g:if>
                    <g:hasErrors bean="${experienciaInstance}">
                        <div class="errors erro">
                            <g:renderErrors bean="${experienciaInstance}" as="list" />
                        </div>
                    </g:hasErrors>
                    <table>
                        <tbody>
                        <input type="hidden" name="estagiario.id" value="${session.pessoa.id}"/>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="empresa"><g:message code="experiencia.empresa.label" default="Empresa" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'empresa', 'errors')}">
                                    <g:textField name="empresa" maxlength="100" size="50" value="${experienciaInstance?.empresa}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="atividade"><g:message code="experiencia.atividade.label" default="Ramo Atividade" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'atividade', 'errors')}">
                                    <g:select name="atividade.id" from="${Atividade.list()}" optionKey="id" value="${experienciaInstance?.atividade?.id}" optionValue="descricao" noSelection="['':'Selecione']"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="telefone"><g:message code="experiencia.telefone.label" default="Telefone" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'telefone', 'errors')}">
                                    <g:textField name="telefone" maxlength="10" value="${experienciaInstance?.telefone}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="vinculo"><g:message code="experiencia.vinculo.label" default="Vinculo" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'vinculo', 'errors')}">
                                  <select name="vinculo" style="width:150px;">
                                    <option value="">Selecione</option>
                                    <option value="Contratado" <%if(experienciaInstance?.vinculo=='Contratado'){%>selected<%}%>>Contratado</option>
                                    <option value="Estagiáro" <%if(experienciaInstance?.vinculo=='Estagiáro'){%>selected<%}%>>Estagiáro</option>
                                    <option value="Freelancer" <%if(experienciaInstance?.vinculo=='Freelancer'){%>selected<%}%>>Freelancer</option>
                                    <option value="Terceirizado" <%if(experienciaInstance?.vinculo=='Terceirizado'){%>selected<%}%>>Terceirizado</option>
                                  </select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="mesIni"><g:message code="experiencia.mesIni.label" default="Mês/Ano Inicio" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'mesIni', 'errors')}">
                                    <select name="mesIni" style="width:150px;">
                                        <option value="">Selecione</option>
                                        <option value="1" <%if(experienciaInstance?.mesIni=='1'){%>selected<%}%>>Janeiro</option>
                                        <option value="2" <%if(experienciaInstance?.mesIni=='2'){%>selected<%}%>>Fevereiro</option>
                                        <option value="3" <%if(experienciaInstance?.mesIni=='3'){%>selected<%}%>>Março</option>
                                        <option value="4" <%if(experienciaInstance?.mesIni=='4'){%>selected<%}%>>Abril</option>
                                        <option value="5" <%if(experienciaInstance?.mesIni=='5'){%>selected<%}%>>Maio</option>
                                        <option value="6" <%if(experienciaInstance?.mesIni=='6'){%>selected<%}%>>Junho</option>
                                        <option value="7" <%if(experienciaInstance?.mesIni=='7'){%>selected<%}%>>Julho</option>
                                        <option value="8" <%if(experienciaInstance?.mesIni=='8'){%>selected<%}%>>Agosto</option>
                                        <option value="9" <%if(experienciaInstance?.mesIni=='9'){%>selected<%}%>>Setembro</option>
                                        <option value="10" <%if(experienciaInstance?.mesIni=='10'){%>selected<%}%>>Outubro</option>
                                        <option value="11" <%if(experienciaInstance?.mesIni=='11'){%>selected<%}%>>Novembro</option>
                                        <option value="12" <%if(experienciaInstance?.mesIni=='12'){%>selected<%}%>>Dezembro</option>
                                    </select>
                                    <%
                                    ano = new Date().format("yyyy")
                                    ano = Integer.parseInt(ano);
                                    %>
                                    <select name="anoIni" style="width:75px;">
                                        <option value=""></option>
                                        <%
                                        for (int i=0; i<60; i++){
                                          %>
                                          <option value="<%=ano-i%>" <%if(experienciaInstance?.anoIni==(ano-i)){%>selected<%}%>><%=ano-i%></option>
                                          <%
                                          }
                                        %>
                                    </select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="mesFim"><g:message code="experiencia.mesFim.label" default="Mês/Ano Fim" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'mesFim', 'errors')}">
                                    <select name="mesFim" style="width:150px;">
                                        <option value="">Selecione</option>
                                        <option value="1" <%if(experienciaInstance?.mesFim=='1'){%>selected<%}%>>Janeiro</option>
                                        <option value="2" <%if(experienciaInstance?.mesFim=='2'){%>selected<%}%>>Fevereiro</option>
                                        <option value="3" <%if(experienciaInstance?.mesFim=='3'){%>selected<%}%>>Março</option>
                                        <option value="4" <%if(experienciaInstance?.mesFim=='4'){%>selected<%}%>>Abril</option>
                                        <option value="5" <%if(experienciaInstance?.mesFim=='5'){%>selected<%}%>>Maio</option>
                                        <option value="6" <%if(experienciaInstance?.mesFim=='6'){%>selected<%}%>>Junho</option>
                                        <option value="7" <%if(experienciaInstance?.mesFim=='7'){%>selected<%}%>>Julho</option>
                                        <option value="8" <%if(experienciaInstance?.mesFim=='8'){%>selected<%}%>>Agosto</option>
                                        <option value="9" <%if(experienciaInstance?.mesFim=='9'){%>selected<%}%>>Setembro</option>
                                        <option value="10" <%if(experienciaInstance?.mesFim=='10'){%>selected<%}%>>Outubro</option>
                                        <option value="11" <%if(experienciaInstance?.mesFim=='11'){%>selected<%}%>>Novembro</option>
                                        <option value="12" <%if(experienciaInstance?.mesFim=='12'){%>selected<%}%>>Dezembro</option>
                                    </select>
                                    <select name="anoFim" style="width:75px;">
                                        <option value=""></option>
                                        <%
                                        for (int i=0; i<60; i++){
                                          %>
                                          <option value="<%=ano-i%>" <%if(experienciaInstance?.anoFim==(ano-i)){%>selected<%}%>><%=ano-i%></option>
                                          <%
                                          }
                                        %>
                                    </select>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="motivoSaida"><g:message code="experiencia.motivoSaida.label" default="Motivo Saída" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'motivoSaida', 'errors')}">
                                    <g:textArea name="motivoSaida" cols="40" rows="5" value="${experienciaInstance?.motivoSaida}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="cargo"><g:message code="experiencia.cargo.label" default="Cargo" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'cargo', 'errors')}">
                                    <g:textField name="cargo" maxlength="30" value="${experienciaInstance?.cargo}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="atribuicoes"><g:message code="experiencia.atribuicoes.label" default="Atribuições" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: experienciaInstance, field: 'atribuicoes', 'errors')}">
                                    <g:textArea name="atribuicoes" cols="40" rows="5" value="${experienciaInstance?.atribuicoes}" />
                                </td>
                            </tr>

                            <tr>
                              <td></td>
                              <td class="btsalvarcadastro">
                                  <g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" />
                              </td>
                            </tr>

                        </tbody>
                    </table>
                </div>

                <div class="dadoslateral">
                  <g:include  view="experiencia/inc_list.gsp" />
                </div>

            </form>
        </div>
    </body>
</html>
